<template>
  <div>
    <h1>Demo.vue</h1>
    <div>Demo vue - {{msg}}</div>
    <div>
      <input type="text" v-model="item">
    </div>
    <button @click="add">Add</button>
  </div>
</template>
<script>
import { add, clear } from '../services/shop'
export default {
  props: {
    msg: {
      type: String,
      required: false
    }
  },
  data () {
    return {
      item: ''
    }
  },
  name: 'DemoVue',
  mounted () {
    setTimeout(() => {
      this.$emit('update:msg', 'vuedemo msg')
      add('Demo.vue Mounted')
    }, 2000)
  },
  methods: {
    add () {
      add('Demo.vue add method')
    },
    empty () {
      clear()
    }
  }
}
</script>
